/* 
 * Copyright (C), 2016-2020, 厦门盈欣宝金融信息服务有限公司
 * Project Name :boot-parent
 * File Name: org.easytouseit.bootprop.controller
 * Encoding UTF-8 
 * Version: 1.0 
 * Date: 2018-07-18 17:28
 * History:  
 * 1. Date: 2018-07-18
 *    Author: guojm 
 *    Modification: 新建
 * 2. ...
 */
package org.easytouseit.bootprop.controller;

import org.easytouseit.bootprop.config.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guojm
 * @version V1.0
 * @date 2018-07-18
 */
@RestController
public class MainController {


    @Value("${blog.name}")
    private String name;
    @Value("${blog.author}")
    private String author;


    @RequestMapping("/prop")
    public String prop() {
        return author +"的博客名称是："+name+"";
    }

    @Autowired
    private Environment env;

    @RequestMapping("/env")
    public String env() {
        return "博客："+env.getProperty("blog.author")+"的作者是："+env.getProperty("blog.name");
    }

    @Autowired
    private CustomizeProp customizeProp;
    @RequestMapping("/cust")
    public String cust() {
        return "博客："+customizeProp.getName()+"的作者是："+customizeProp.getAuthor();
    }
    @RequestMapping("/msg")
    public String msg() {
        return env.getProperty("blog.massage");
    }
    @Autowired
    private ConfigProp configProp;
    @RequestMapping("/config")
    public String config() {
        return "博客分类："+configProp.getCategory()+"博客标签："+configProp.getTag();
    }
    @Autowired
    private EtuProperties etuProperties;
    @RequestMapping("/etu")
    public String etu() {
        return "random："+etuProperties.getKey()+"-number："+etuProperties.getNumber()+"-long："+etuProperties.getBigNumber()
                +"-uuid："+etuProperties.getUuid()+"-int："+etuProperties.getIntNumber()+"-range："+etuProperties.getRange();
    }
    @Autowired
    private DataProperties dataProperties;
    @RequestMapping("/data")
    public String data() {
        return dataProperties.toString();
    }
    @Autowired
    private ValidateProp validateProp;
    @RequestMapping("/validate")
    public String validate() {
        return validateProp.toString();
    }
}
